﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Queue
{
    class MyQueue <T>
    {

        private T[] array;
        public int pushPosition = 0;
        public int popPosition = 0;

        public T this[int index]
        {
            get { return array[index]; }
        }
        public int Capacity
        {
            get { return array.Length; }
        }


        public MyQueue()
        {
            array = new T[5];
        }

        public void Push(T value)
        {
            if (pushPosition < Capacity)
            {
                array[pushPosition] = value;
              
            }
           
           else
            {
                pushPosition=0;
                array[pushPosition] = value;

            }
            pushPosition++;
        }

       
        public void Pop()
        {
            if (pushPosition != Capacity)
                  Console.WriteLine("First in the queue is {0}", array[pushPosition]);
              
            else
                Console.WriteLine("First in the queue is {0}", array[0]);


        }

        public void PrintArray()
        {
             for(int i=0; i< Capacity; i++)
            {
                Console.WriteLine(array[i]);
            }
           
        }

        public void Clear()
        {
            pushPosition = 0;
            popPosition = 0;
            T[] array1 = new T[5];
            array = array1;

        }



    }
}
